//电站详情js
$(function(){	
	//wapper-main
	//$(".wapper-main").height($(window).height() - $(".wapper-header").height());

	//初始化charts
	drawEcharts1();
	drawEcharts2();
	drawEcharts3();
	drawEcharts4();

});

//准确率直方图
function drawEcharts1(){
	var myChart = echarts.init(document.getElementById('indexChart1'));

	var option = {
	    legend: {
	        data:['短期', '超短期'],
        	left: "right"
	    },
	    tooltip : {
	        trigger: 'axis',
	        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	        }
	    },
	    grid: {
	        left: '0%',
	        right: '0%',
	        bottom: '20%',
	        y: 30,
	        containLabel: true
	    },
	    xAxis : [
	        {
	            type : 'category',
	            data : ['老河口光伏','齐岳山一期','齐岳山二三期','利川一二期','荆门象河','麻城蔡家寨','麻城阎家河','黄石荺山','花山光伏','九宫山风场'],
	            axisTick: {
	                alignWithLabel: true
	            },
	            axisLabel: {  
	            	interval:0, 
	            	rotate: 40, 
                }  
	        }
	    ],
	    yAxis : [
	        {
	            type : 'value',
	            axisLabel: {  
                  	show: true,  
                  	interval: 'auto',  
                  	formatter: '{value} %'  
                },  
	            show: true 
	        }
	    ],
	    series : [
	        {
	            name:'短期',
	            color: ['#50b8df'],
	            type:'bar',
	            barWidth: '20%',
	            data:[10, 44, 12, 20, 10, 32, 40, 10, 32, 40],
	        },
	        {
	            name:'超短期',
	            color: ['#efab09'],
	            type:'bar',
	            barWidth: '20%',
	            data:[10, 52, 29, 34, 90, 50, 80, 56, 23, 55]
	        }
	    ]
	};
    myChart.setOption(option);
}

//未来三天电量预测
function drawEcharts2(){
	var myChart = echarts.init(document.getElementById('indexChart2'));

	var option = {
	    tooltip : {
	        trigger: 'axis',
	        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
	            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	        }
	    },
	    grid: {
	        left: '0%',
	        right: '0%',
	        bottom: '20%',
	        y: 30,
	        containLabel: true
	    },
	    xAxis : [
	        {
	            type: 'category',
	            data: ['老河口光伏','齐岳山一期','齐岳山二三期','利川一二期','荆门象河','麻城蔡家寨','麻城阎家河','黄石荺山','花山光伏','九宫山风场'],
	            axisTick: {
	                alignWithLabel: true
	            },
	            axisLabel: {  
	            	interval: 0, 
	            	rotate: 40, 
                }  
	        }
	    ],
	    yAxis : [
	        {
	            type: 'value',
	            name: '万kwh',
	            min: 0,
	            max: 1000,
	            interval: 500,
	            show: true 
	        }
	    ],
	    series : [
	        {
	            name:'短期',
	            color: ['#50b8df'],
	            type:'bar',
	            barWidth: '20%',
	            data:[100, 440, 120, 200, 100, 320, 400, 100, 320, 400],
	        }
	    ]
	};
    myChart.setOption(option);
}

//今日功率预测对比
function drawEcharts3(){
	var myChart = echarts.init(document.getElementById('indexChart3'));

	var option = {
	    title: {
	        text: '今日功率预测对比',
	        textStyle: {
	        	color: '#585858',
	        	fontSize: 16,
	        	fontWeight: 'normal'
	        }
	    },
	    legend: {
	        data:['预测功率', '实发功率', '置信区间'],
        	left: "right",
        	y: 30
	    },
	    tooltip : {
	        trigger: 'axis',
	        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
	            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	        }
	    },
	    grid: {
	        left: '3%',
	        right: '4%',
	        bottom: '3%',
	        y: 60,
	        containLabel: true
	    },
	    xAxis : [
	        {
	            type : 'category',
	            data : ['00:00','08:00','16:00','24:00'],
	            axisTick: {
	                alignWithLabel: true
	            },
	            axisLabel: {  
	            	interval:0, 
                }  
	        }
	    ],
	    yAxis : [
	        {
	            type : 'value',
	            name: 'MW',
	            min: 0,
	            max: 300,
	            interval: 100,
	            show: true 
	        }
	    ],
	    series : [
	        {
	            name:'预测功率',
	            color: ['#006cff'],
	            type:'line',
	            barWidth: '20%',
	            data:[110, 44, 122, 60],
	        },
	        {
	            name:'实发功率',
	            color: ['#14ed7d'],
	            type:'line',
	            barWidth: '20%',
	            data:[130, 52, 29, 44]
	        },
	        {
	            name:'置信区间',
	            color: ['#50b8df'],
	            type:'bar',
	            barWidth: '20%',
	            data:[150, 80, 156, 93]
	        }
	    ]
	};
    myChart.setOption(option);
}

//本月发电量指标对比
function drawEcharts4(){
	var myChart = echarts.init(document.getElementById('indexChart4'));

	var option = {
	    title: {
	        text: '本月发电量指标对比',
	        textStyle: {
	        	color: '#585858',
	        	fontSize: 16,
	        	fontWeight: 'normal'
	        }
	    },
	    legend: {
	        data:['理论电量', '实际电量', '预测电量'],
        	left: "right",
        	y: 30
	    },
	    tooltip : {
	        trigger: 'axis',
	        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
	            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
	        }
	    },
	    grid: {
	        left: '3%',
	        right: '4%',
	        bottom: '3%',
	        y: 60,
	        containLabel: true
	    },
	    xAxis : [
	        {
	            type : 'category',
	            data : ['00:00','08:00','16:00','24:00'],
	            axisTick: {
	                alignWithLabel: true
	            },
	            axisLabel: {  
	            	interval:0, 
                }  
	        }
	    ],
	    yAxis : [
	        {
	            type : 'value',
	            name: '万kWh',
	            min: 0,
	            max: 800,
	            interval: 400,
	            show: true 
	        }
	    ],
	    series : [
	        {
	            name:'理论电量',
	            color: ['#006cff'],
	            type:'bar',
	            barWidth: '15%',
	            data:[510, 444, 322, 260],
	        },
	        {
	            name:'实际电量',
	            color: ['#64ff58'],
	            type:'bar',
	            barWidth: '15%',
	            data:[530, 452, 329, 244]
	        },
	        {
	            name:'预测电量',
	            color: ['#f0c756'],
	            type:'bar',
	            barWidth: '15%',
	            data:[550, 480, 356, 293]
	        }
	    ]
	};
    myChart.setOption(option);
}